<template>
  <div>
    <h1>详情-2</h1>
    <div class="aaa">
      <p>{{ details.productInfo2 }}</p>
    </div>
    <button @click="jump">点击返回列表</button>
  </div>
</template>

<script>
export default {
  props: ["productid"],
  data() {
    return {
      details: "",
    };
  },
  mounted() {
    // console.log(this.$route.params);
    let { productid } = this.$route.params;
    fetch(`http://chst.vip:1234/api/getmoneyctrlproduct?productid=${productid}`)
      .then((body) => body.json())
      .then((res) => {
        console.log(res);
        this.details = res.result[0];
      });
  },
  methods: {
    jump() {
      //使用push跳转
      // this.$router.push("/list-2")
      // this.$router.push({ path: "/list-2" })
      //使用query
      // this.$router.push({ path: '/list-2', query: { name: '李雷' } })
      //使用params
      this.$router.push({ name: "list-2", params: { name: "李雷" } });
    },
  },
};
</script>

<style scoped>
.aaa {
  width: 500px;
}
</style>
